package part2;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		X[] objs = new X[4];
		
		objs[0] = new ClassA();
		objs[1] = new ClassB( 2000 );
		objs[2] = new ClassA();
		objs[3] = new ClassB( 500 );
		
		System.out.println("Starting values:");
		for (X ob : objs)
			System.out.println( "  " + ob.getClass().getName() + "   " + ob.getx() + "   " + ob.gety() );

		System.out.println("Setting y in objs[2]");
		( ( ClassA ) objs[2] ).sety( 200 );
		( ( ClassB ) objs[3] ).sety( 750 );
		//( ( ClassA ) objs[2] ).setx( 100 );
		
		for (X ob : objs)
			System.out.println( "  " + ob.getClass().getName() + "   " + ob.getx() + "   " + ob.gety() );
	}

}
